import { defineStore } from 'pinia'
import mobile from 'is-mobile'

export const useAppStore = defineStore('appStore', {
  state: () => {
    return {
      sidebarOpen: true,
      withoutAnimation: false,
      enableTopNav: false,
      theme: 'dark',
      mobileClient: mobile()
    }
  },
  getters: {
    enableDarkTheme: (state) => {
      return state.theme === 'dark'
    },
    sidebarCollapse: (state) => {
      return !state.sidebarOpen
    }
  },
  actions: {
    sidebarToggle(val) {
      this.sidebarOpen = val || !this.sidebarOpen
      //   console.log(val, this.sidebarOpen)
    }
  }
})

// export default appStore
